import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized";
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _create_class } from "@swc/helpers/_/_create_class";
import { _ as _define_property } from "@swc/helpers/_/_define_property";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
import { _ as _possible_constructor_return } from "@swc/helpers/_/_possible_constructor_return";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
import { store } from "../store";
import EventEmitter from "eventemitter3";
import { useDispatch, useSelector } from "react-redux";
import i18n from "../local";
import { switchVersion } from "../utils";
import * as Api from "../_api_";
import * as GlobalFun from "../globalFun";
/** 对外暴露的方法 */ var KingsWalletInstance = /*#__PURE__*/ function _target(EventEmitter) {
    "use strict";
    _inherits(KingsWalletInstance, EventEmitter);
    var _super = _create_super(KingsWalletInstance);
    function KingsWalletInstance() {
        _class_call_check(this, KingsWalletInstance);
        var _this;
        _this = _super.call(this);
        /** 所有api */ _define_property(_assert_this_initialized(_this), "Api", Api);
        _define_property(_assert_this_initialized(_this), "GlobalFun", GlobalFun);
        _define_property(_assert_this_initialized(_this), "useRootState", function() {
            return useSelector(function(state) {
                return state;
            });
        });
        _define_property(_assert_this_initialized(_this), "authConfig", {
            REDIRECT_URI: "https://www.bling.social",
            GOOGLE_CLIENTID: "365046613792-gtvg8u0aq0d8u30el6san0u0mfkrrnr9.apps.googleusercontent.com",
            GOOGLE_SECRET: "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",
            /** ona 自身值 */ ONA_APPID: "1001",
            ONA_APP_SECRET: "8L0deu6KxrPz6rk1LYFC6m7bOGqGPweKmCxVRKCScWg=",
            APPLE_APPID: "social.bling.www",
            TWITTER_CLIENTID: "d0Nkel9LZGs2VlI2aGlOdlU0dGc6MTpjaQ",
            TWITTER_SECRET: "_-q4OwW87BVwg02cYRBm7heUt9pYddc8dzZHWKv3htbNYHZGdK",
            TWITTER_CONSUMER_KEY: "weSuwTNjqn84WbyAQEkYvQ6j2",
            TWITTER_CONSUMER_SECRET: "4MtbpwHsukJAKp3713PF22s2gI4gz2jykX11ONCTA5134xgpSx"
        });
        _define_property(_assert_this_initialized(_this), "getAuthConfig", function() {
            return _this.authConfig;
        });
        _define_property(_assert_this_initialized(_this), "setAuthConfig", function(newAuthConfig) {
            var newConfig = _object_spread({}, _this.authConfig, newAuthConfig);
            _this.authConfig = newConfig;
            return newConfig;
        });
        _define_property(_assert_this_initialized(_this), "payConfig", {
            // 测试商户id:AP773YQ9JRQNG
            MERCHANT_ID: "AP773YQ9JRQNG",
            //测试客户端client_id:AVbwYNRZTX2rFYHHrzdGhJsMwrNAzx2WfrSMRM506ln_3ICt9dVqAwf220PHJbjasE0g3yA8nNQQmVXa
            CLIENT_ID: "AVbwYNRZTX2rFYHHrzdGhJsMwrNAzx2WfrSMRM506ln_3ICt9dVqAwf220PHJbjasE0g3yA8nNQQmVXa",
            paypalUri: "https://www.paypal.com/sdk/js?client-id=AVbwYNRZTX2rFYHHrzdGhJsMwrNAzx2WfrSMRM506ln_3ICt9dVqAwf220PHJbjasE0g3yA8nNQQmVXa&currency=EUR,USD,CAD&component=buttons,applepay,googlepay&disable-funding=paylater,mybank,giropay,ideal,eps,blik,mercadopago"
        });
        _define_property(_assert_this_initialized(_this), "setPayConfig", function(newPayConfig) {
            var newConfig = _object_spread({}, _this.payConfig, newPayConfig);
            _this.payConfig = newConfig;
            return newConfig;
        });
        _define_property(_assert_this_initialized(_this), "getPayConfig", function() {
            return _this.payConfig;
        });
        _define_property(_assert_this_initialized(_this), "changeLanguage", function(lang) {
            if (i18n.language === lang) {
                return;
            }
            i18n.changeLanguage();
        });
        _define_property(_assert_this_initialized(_this), "switchDomestic", function(domestic) {
            switchVersion(domestic);
        });
        /** 展示分享的nft */ _define_property(_assert_this_initialized(_this), "showNFTDetails", function(nftInfo, dom) {
            return new Promise(function(resolve) {
                /** 跳转到分享页面 */ store.dispatch.app.PUSH({
                    path: "/nftDetails",
                    query: _object_spread_props(_object_spread({}, nftInfo), {
                        isShare: true
                    })
                });
                /** 打开ona popover */ store.dispatch.app.SWITCH_VISIBLE(true, dom);
                resolve(store.getState());
            });
        });
        if ((_instanceof(this, KingsWalletInstance) ? this.constructor : void 0) !== KingsWalletInstance) {
            return _possible_constructor_return(_this);
        }
        if (!KingsWalletInstance._instance) {
            KingsWalletInstance._instance = _assert_this_initialized(_this);
        }
        if (KingsWalletInstance.getOnaConfig()) {
            _this.setAuthConfig({
                REDIRECT_URI: "https://www.ona.social",
                APPLE_APPID: "social.ona.www",
                ONA_APPID: "1000",
                ONA_APP_SECRET: "uKHrQ/9tOtEIDBkMFxf+8UZOOyoeRWdDW43PJD+/TS4="
            });
        }
        return _possible_constructor_return(_this, KingsWalletInstance._instance);
    }
    _create_class(KingsWalletInstance, [
        {
            key: "useDispatch",
            value: function useDispatch1() {
                return useDispatch();
            }
        }
    ], [
        {
            key: "getInstance",
            value: function getInstance() {
                if (!KingsWalletInstance._instance) {
                    KingsWalletInstance._instance = new KingsWalletInstance();
                }
                return KingsWalletInstance._instance;
            }
        },
        {
            key: "getOnaConfig",
            value: function getOnaConfig() {
                var reg = /ona.social/;
                var originHref = window.location.origin || "";
                return reg.test(originHref);
            }
        }
    ]);
    return KingsWalletInstance;
}(EventEmitter);
_define_property(KingsWalletInstance, "_instance", null);
var kingsInstance = KingsWalletInstance.getInstance();
export default kingsInstance;

 //# sourceMappingURL=index.js.map